package org.htmlparser.util;

import java.util.Vector;

public class ChainedException extends Exception
{
  protected Throwable throwable;

  public ChainedException(String paramString)
  {
    super(paramString);
  }

  public ChainedException(String paramString, Throwable paramThrowable)
  {
    super(paramString);
    this.throwable = paramThrowable;
  }

  public ChainedException(Throwable paramThrowable)
  {
    this.throwable = paramThrowable;
  }

  public String[] getMessageChain()
  {
    Vector localVector = getMessageList();
    String[] arrayOfString = new String[localVector.size()];
    localVector.copyInto(arrayOfString);
    return arrayOfString;
  }

  public Vector getMessageList()
  {
    Vector localVector1 = new Vector();
    localVector1.addElement(getMessage());
    if (this.throwable != null)
    {
      if (this.throwable instanceof ChainedException)
      {
        Vector localVector2 = ((ChainedException)this.throwable).getMessageList();
        int i = 0;
        while (true)
        {
          if (i >= localVector2.size())
            break label98;
          localVector1.addElement(localVector2.elementAt(i));
          ++i;
        }
      }
      String str = this.throwable.getMessage();
      if ((str != null) && (!(str.equals(""))))
        localVector1.addElement(str);
    }
    label98: return localVector1;
  }

  public Throwable getThrowable()
  {
    return this.throwable;
  }

  public void printStackTrace()
  {
    printStackTrace(System.err);
  }

  // ERROR //
  public void printStackTrace(java.io.PrintStream paramPrintStream)
  {
    // Byte code:
    //   0: aload_1
    //   1: monitorenter
    //   2: aload_0
    //   3: getfield 16	org/htmlparser/util/ChainedException:throwable	Ljava/lang/Throwable;
    //   6: ifnull +55 -> 61
    //   9: aload_1
    //   10: new 70	java/lang/StringBuffer
    //   13: dup
    //   14: invokespecial 71	java/lang/StringBuffer:<init>	()V
    //   17: aload_0
    //   18: invokevirtual 77	java/lang/Object:getClass	()Ljava/lang/Class;
    //   21: invokevirtual 82	java/lang/Class:getName	()Ljava/lang/String;
    //   24: invokevirtual 86	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   27: ldc 88
    //   29: invokevirtual 86	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   32: aload_0
    //   33: invokevirtual 42	java/lang/Throwable:getMessage	()Ljava/lang/String;
    //   36: invokevirtual 86	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   39: ldc 90
    //   41: invokevirtual 86	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   44: invokevirtual 93	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   47: invokevirtual 98	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   50: aload_0
    //   51: getfield 16	org/htmlparser/util/ChainedException:throwable	Ljava/lang/Throwable;
    //   54: aload_1
    //   55: invokevirtual 99	java/lang/Throwable:printStackTrace	(Ljava/io/PrintStream;)V
    //   58: aload_1
    //   59: monitorexit
    //   60: return
    //   61: aload_0
    //   62: aload_1
    //   63: invokespecial 99	java/lang/Throwable:printStackTrace	(Ljava/io/PrintStream;)V
    //   66: goto -8 -> 58
    //   69: astore_2
    //   70: aload_1
    //   71: monitorexit
    //   72: aload_2
    //   73: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   2	72	69	finally
  }

  // ERROR //
  public void printStackTrace(java.io.PrintWriter paramPrintWriter)
  {
    // Byte code:
    //   0: aload_1
    //   1: monitorenter
    //   2: aload_0
    //   3: getfield 16	org/htmlparser/util/ChainedException:throwable	Ljava/lang/Throwable;
    //   6: ifnull +55 -> 61
    //   9: aload_1
    //   10: new 70	java/lang/StringBuffer
    //   13: dup
    //   14: invokespecial 71	java/lang/StringBuffer:<init>	()V
    //   17: aload_0
    //   18: invokevirtual 77	java/lang/Object:getClass	()Ljava/lang/Class;
    //   21: invokevirtual 82	java/lang/Class:getName	()Ljava/lang/String;
    //   24: invokevirtual 86	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   27: ldc 88
    //   29: invokevirtual 86	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   32: aload_0
    //   33: invokevirtual 42	java/lang/Throwable:getMessage	()Ljava/lang/String;
    //   36: invokevirtual 86	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   39: ldc 90
    //   41: invokevirtual 86	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   44: invokevirtual 93	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   47: invokevirtual 103	java/io/PrintWriter:println	(Ljava/lang/String;)V
    //   50: aload_0
    //   51: getfield 16	org/htmlparser/util/ChainedException:throwable	Ljava/lang/Throwable;
    //   54: aload_1
    //   55: invokevirtual 105	java/lang/Throwable:printStackTrace	(Ljava/io/PrintWriter;)V
    //   58: aload_1
    //   59: monitorexit
    //   60: return
    //   61: aload_0
    //   62: aload_1
    //   63: invokespecial 105	java/lang/Throwable:printStackTrace	(Ljava/io/PrintWriter;)V
    //   66: goto -8 -> 58
    //   69: astore_2
    //   70: aload_1
    //   71: monitorexit
    //   72: aload_2
    //   73: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   2	72	69	finally
  }
}